package com.yunchang.springboot.mapper.mwsreport;

import com.yunchang.springboot.models.mwsreportbean.MwsInventoryAdjustments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MwsInventoryAdjustmentsMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(MwsInventoryAdjustments record);

    int insertSelective(MwsInventoryAdjustments record);

    MwsInventoryAdjustments selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MwsInventoryAdjustments record);

    int updateByPrimaryKey(MwsInventoryAdjustments record);

    String getLatestDay(@Param("sellerId") String sellerId, @Param("area") String area);

    /**
     * 根据createTime获取对应的数据
     * @param time
     * @return
     */
    List<MwsInventoryAdjustments> selectByCreateTime(String time);

    /**
     * 根据参数获取对应的quantity的和
     * @param sellerId
     * @param adjustedDate
     * @param sku
     * @param fulfillmentCenterId
     * @param reasonList
     * @return
     */
    Integer selectSumQuantityBySellerIdAndAdjustedDateAndSkuAndFulfillmentCenterIdAndReasonList(@Param("sellerId") String sellerId,@Param("adjustedDate") String adjustedDate,@Param("sku") String sku,@Param("fulfillmentCenterId") String fulfillmentCenterId,@Param("reasonList") List<String> reasonList);

    /**
     * 根据参数获取对应的quantity的和
     * @param sellerId
     * @param sku
     * @param adjustedDate
     * @param reason
     * @return
     */
    Integer selectSumQuantityBySellerIdAndAdjustedDateAndSkuAndReason(String sellerId,String sku,String adjustedDate,String reason);

    /**
     * 根据是否生成财务数据获取对应的数据，limitValue指定获取数据的大小
     * @param financeStatus
     * @param limitValue
     * @param reasonList
     * @param date
     * @return
     */
    List<MwsInventoryAdjustments> selectByFinanceStatus(@Param("financeStatus") Integer financeStatus,@Param("limitValue") Integer limitValue,@Param("reasonList") List<String> reasonList,@Param("date") String date);

    /**
     * 根据mwsInventoryAdjustmentsList对象集合更新financeStatus
     * @param mwsInventoryAdjustmentsList
     * @return
     */
    int updateFinanceStatusByMwsInventoryAdjustmentsList(@Param("mwsInventoryAdjustmentsList") List<MwsInventoryAdjustments> mwsInventoryAdjustmentsList);
}